﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Assignment5
{
    /*
     * 订单详细信息，包括订单简单信息，订单所有货物的种类，单价，订购数量及订单总金额
    */
    public class OrderDetail
    {
        Order order;
        public OrderDetail(Order order)
        {
            this.order = order;
        }
        public override string ToString()
        {
            string s = "";
            foreach ((Goods g, int i) in order.orderedCatalogue)
            {
                s += "" + g + $", num: {i}\r\n";
            }
            return order.ToString() + "    Goods info: " + s + $"Money Amount: {order.GetAmount()}\r\n";

        }
        public override bool Equals(object obj)
        {
            OrderDetail detail = (OrderDetail)obj;
            return ToString().Equals(detail.ToString());
        }

        public override int GetHashCode()
        {
            return ToString().GetHashCode();
        }
    }
}
